/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sbbs.springboot.sample9;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

/**
 *
 * @author MACHENIKE
 */
@SpringBootApplication
@ServletComponentScan//这个就是扫描相应的Servlet包;
public class App {

    /**
     * 注册Servlet.不需要添加注解：@ServletComponentScan
     *
     * @return
     */
    @Bean
    public ServletRegistrationBean MyServlet1() {
        return new ServletRegistrationBean(new MyServlet1(), "/myServlet1/*");
    }

    public static void main(String[] args) {
        SpringApplication.run(App.class, args);
    }
}
